package com.yyj.dao;

import com.yyj.entity.Calendar;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CalendarDao {
    @Select("select * from calendar where userId=#{userId}")
    List<Calendar> getCalendar(Integer userId);

    @Insert("insert calendar(date,content,userId) values (#{date},#{content},#{userId})")
    void saveCalendar(Calendar calendar);

    @Select("select * from calendar where date=#{date} and userId=#{userId} ")
    Calendar getByDate(Calendar calendar);

    @Update("update calendar set content=#{content} where date=#{date} and userId=#{userId}")
    void update(Calendar calendar);
}
